package com.katze.boot.quartz.domain;

import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.katze.boot.common.converter.DateTimeStringConverter;
import com.katze.boot.common.converter.JobStatus;
import lombok.Data;

import java.io.Serializable;
import java.util.Date;

@Data
@TableName("sys_job")
@ExcelIgnoreUnannotated
public class Job implements Serializable {

    private static final long serialVersionUID = 400066840871805700L;

    /**
     * 任务调度参数 key
     */
    public static final String JOB_PARAM_KEY = "JOB_PARAM_KEY";

    public enum ScheduleStatus {
        /**
         * 正常
         */
        NORMAL("1"),
        /**
         * 暂停
         */
        PAUSE("0");

        private String value;

        ScheduleStatus(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }
    }

    @TableId(value = "JOB_ID", type = IdType.AUTO)
    private Long jobId;

    @ExcelProperty(value = "任务名称")
    private String name;

    private Long groupId;

    @ExcelProperty(value = "Bean名称")
    private String beanName;

    @ExcelProperty(value = "方法名称")
    private String methodName;

    @ExcelProperty(value = "方法参数")
    private String params;

    @ExcelProperty(value = "Cron表达式")
    private String cronExpression;

    @ExcelProperty(value = "状态", converter = JobStatus.class)
    private String status;

    @ExcelProperty(value = "备注")
    private String remark;

    @ExcelProperty(value = "创建时间", converter = DateTimeStringConverter.class)
    private Date createTime;

    private transient String createTimeFrom;
    private transient String createTimeTo;

}
